/* eslint valid-jsdoc: "off" */

'use strict';

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1589709721571_1773';

  // add your middleware config here
  config.middleware = [];

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  // 配置 jwt token 加密
  config.jwt = {
    secret: "dwpnb"//自定义 token 的加密条件字符串
  };

  // 关闭post csrf 验证
  config.security = {
    csrf: false
  };

  // 解决跨域
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
  };

  // 配置数据库
  config.mongoose = {
    url: 'mongodb://127.0.0.1/vipEgg',
    options: {},
  }

  return {
    ...config,
    ...userConfig,
  };
};
